home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Developer's Kit 1996
/
Delphi Developer's Kit 1996.iso
/
power
/
enterctl
/
entgrid.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-12-22
|
966b
|
54 lines
unit Entgrid;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, Grids;
type
TEnterGrid = class(TStringGrid)
private
{ Private declarations }
protected
{ Protected declarations }
procedure KeyPress(var Key: Char); override;
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TEnterGrid]);
end;
procedure TEnterGrid.KeyPress(var Key: Char);
begin
if Key = #13 then
begin
if Col < (ColCount - FixedCols) then
begin
Col := Col + 1;
Key := #0;
end
else if Row < (RowCount - FixedRows) then
begin
Col := 1;
Row := Row + 1;
Key := #0;
end;
end;
if Key <> #0 then inherited KeyPress(Key);
end;
end.